<template>
  <div>
    <el-button @click="getUserById">根据Id查询用户</el-button>
    <h2>{{ user.username }}</h2>
    <h2>{{ user.password }}</h2>
  </div>
</template>


<script>

// import request from "@/network/request";

export default {
  name: "C3AxiosView",
  data() {
    return {
      user: {
        username: undefined,
        password: undefined,
      },
    }
  },
  methods: {
    getUserById: function () {
      this.request({
            url: "/user/getUserById?id=1",
            method: 'get'
          }
      ).then(res => {
        console.log("res=", res);
        this.user = res;
        // this.$message({
        //   type: "success",
        //   showClose: true,
        //   message: "查询成功"
        // })
      }).catch(err => {
        console.log(err)
      });
    },
  }
}
</script>

<style scoped>

</style>